/*
 * (C) APUE
 * read from a file, then write to a new file
 * dup std to file
 */
#include "apue.h"

#define	BUFFSIZE	4096

int main()
{
	int n;
	char buf[BUFFSIZE];
	while ((n = read(STDIN_FILENO, buf, BUFFSIZE)) > 0)
		if (n != write(STDOUT_FILENO, buf, n))
			err_quit("write error");

	if (n < 0)
		err_quit("read error");

	return 0;
}
